/* 凯撒加密 */
#include <stdio.h>
#define N 80
int main(void)
{
    char ch, msg[N];
    printf("Enter message to be encrypted: ");
    for (int i = 0; i < N; i++) {
        ch = getchar();
        msg[i] = ch;
        if (ch == '\n')
            break;
    }
    printf("Enter shift amout (1-25): ");
    int shift;
    scanf("%d", &shift);
    printf("Encrypted message: ");
    for (int i = 0; i < N; i++) {
        if (((msg[i] - 'A') >= 0) && ((msg[i] - 'A') < 26))
            printf("%c", ((msg[i] - 'A') + shift) % 26 + 'A');
        else if (((msg[i] - 'a') >= 0) && ((msg[i] - 'a') < 26))
            printf("%c", ((msg[i] - 'a') + shift) % 26 + 'a');
        else
            printf("%c", msg[i]);
            if (msg[i] == '\n')
                break;
    }
    return 0;
}